#ifndef __CONFIG_H__
#define __CONFIG_H__

#include <string>
#include <vector>

#include "BaseThread/BaseThread.h"
#include "Json/JsonFile.h"
#include "Poco/Mutex.h"
#include "Poco/JSON/Object.h"

#define CONFIG_FILE "./config.json"
#define TESTJSON_FILE "./JsonPathTest.json"

class Config : public JsonFile, public BaseThread
{
public:
    Config();

public:
    virtual int SingleStep();

public:
    virtual int Set(std::string strKey, Poco::Dynamic::Var var);
    virtual int Add(std::string strKey, Poco::Dynamic::Var var);
    virtual int Del(std::string strKey);

private:
    static Config* m_pInstance;
    bool m_bChange;
};

class ConfigManager
{
public:
    static ConfigManager* Instance();

public:
    Config* GetConfig(std::string strName);

private:
    ConfigManager() { ; }
    ~ConfigManager();

private:
    static ConfigManager* m_pInstance;
    std::map<std::string, Config*> m_mapConfig;
};

#endif //__CONFIG_H__
